package com.noahplat.person.pojo;


import lombok.Data;
import org.hibernate.validator.constraints.Length;
import tk.mybatis.mapper.annotation.KeySql;

import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.List;

/**
 * 功能：人员健康指数实体类
 * name:宋彦磊
 * time:2021.02.28
 */

@Data
@Table(name = "tb_physical")
public class Physical implements Serializable {
    @Id
    @KeySql(useGeneratedKeys = true)
    private Long id;   //主键ID
    private Long pid;  //人员ID

    @NotNull(message = "血压不能为空")
    @Length(max = 10)
    private String blood; //血压

    @NotNull(message = "空腹血葡萄糖不能为空")
    @Length(max = 20)
    private String fbg;  //空腹血葡萄糖

    @NotNull(message = "总胆固醇不能为空")
    @Length(max = 20)
    private String tc;  //总胆固醇

    @NotNull(message = "高密度脂蛋白不能为空")
    @Length(max = 20)
    private String hdl;  //高密度脂蛋白

    @NotNull(message = "低密度脂蛋白不能为空")
    @Length(max = 20)
    private String ldl;  //低密度脂蛋白

    @NotNull(message = "甘油三酯不能为空")
    @Length(max = 20)
    private String tg;  //甘油三酯

    @NotNull(message = "尿酸不能为空")
    @Length(max = 20)
    private String ua;  //尿酸

    @Transient
    private List<HealthRecord> healthRecords;   //表外字段，用于封装体检报告

    /**
     * 重写无参构造
     */
    public Physical() {
    }

    /**
     * 重写有参构造
     * @param pid
     * @param blood
     * @param fbg
     * @param tc
     * @param hdl
     * @param ldl
     * @param tg
     * @param ua
     */
    public Physical(Long pid, @NotNull(message = "参数不能为null") @Length(max = 10) String blood, @NotNull(message = "参数不能为null") @Length(max = 20) String fbg, @NotNull(message = "参数不能为null") @Length(max = 20) String tc, @NotNull(message = "参数不能为null") @Length(max = 20) String hdl, @NotNull(message = "参数不能为null") @Length(max = 20) String ldl, @NotNull(message = "参数不能为null") @Length(max = 20) String tg, @NotNull(message = "参数不能为null") @Length(max = 20) String ua) {
        this.pid = pid;
        this.blood = blood;
        this.fbg = fbg;
        this.tc = tc;
        this.hdl = hdl;
        this.ldl = ldl;
        this.tg = tg;
        this.ua = ua;
    }
}
